<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:if test="${record.purchaseBill.billType=='BUY'}">
	<c:set var="billTypeName" value="采购" />
	<c:set var="stocName" value="入库" />
</c:if>
<c:if test="${record.purchaseBill.billType=='BACK'}">
	<c:set var="billTypeName" value="退货" />
	<c:set var="stocName" value="出库" />
</c:if>
<c:set var="pageTopTitle" value="${billTypeName}单${stocName}" />
<c:set var="pageTitle" value="${pageTopTitle}" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doCancel(){
		parent.ClosePop();
	}
	function doStoc(id){
		var url="/CalendarSelect.ihtm?title="+encodeURIComponent("${billTypeName}单${stocName}")+"&label="+encodeURIComponent("${stocName}日期");
		ShowIframe("选择日期",url,310,200,"doStocCallBack('"+id+"')");
	}
	function doStocCallBack(id){
		if(popRetVal!=null){
			window.location="PurchaseBillStoc.ihtm?id_str="+id+"&date_str="+popRetVal+"&flag=1";
		}
	}
	function doInit(){
	}
</script>
</head>
<body oncontextmenu="return false" onload="doInit();" class="sheet modal-dialog" style=" padding-top:10px;">
<div class="sheet-main" id="bodyDiv" style="width:860px;">
  <div class="sheet-list" style="width:100%">
    <div class="modal-main search-business">
    	<div style="width:100%;">
    	<table border="0" cellspacing="0" cellpadding="0" align="center" class="table-0">
			<tr>
				<td style="width:33%" rowspan="2"></td>
				<td style="width:33%;text-align:center" rowspan="2"><h2>${pageTopTitle}</h2></td>
				<td style="width:34%" class="tr">
					编号：${record.purchaseBill.billCode}
				</td>
			</tr>
			<tr>
				<td class="tr">${billTypeName}日期：<fmt:formatDate value="${record.purchaseBill.purchaseDate}" pattern="yyyy-MM-dd HH:mm"/></td>
			</tr>
		</table>
		
		<table border="0" cellspacing="0" cellpadding="0" align="center" class="table-0">
		    <tr>
				<td class="InfoTitleDivider"></td>
			</tr>
		</table>
		
		<table border="0" cellspacing="0" cellpadding="0" align="center" class="table-0">
			<tr>
		      	<th style="width:10%">供应商：</th>
		      	<td style="width:23%">${record.providerName}</td>
		      	<th style="width:10%">${billTypeName}仓库：</th>
		     	<td style="width:23%"><commonTag:showSimpleObjectName list="${storehouseList}" objectId="${record.purchaseBill.storehouseId}" /></td>
		    	<td class="tr" style="width:34%">订单合同号：${record.purchaseBill.contractCode}</td>
		    </tr>
		</table>
		
		<table border="0" cellspacing="0" cellpadding="0" align="center" class="table-0">
		    <tr>
				<td class="InfoTitleDivider"></td>
			</tr>
		</table>
		
		<div class="table-list">
			<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center" id="itemTbl">
				<tbody id="itemRowTbl">
				<tr>
					<th width="20%" >材料编号</th>
					<th width="28%" >品名规格</th>
					<th width="12%" >单位</th>
					<th width="12%" >数量</th>
					<th width="28%" >备注</th>
				</tr>
				<c:forEach var="item" items="${record.items}" varStatus="i">
				<tr>
					<td >${item.productCode}</td>
					<td >${item.productName}</td>
					<td >${item.unit}</td>
					<td ><div align="right"><commonTag:parseBigDecimal source="${item.purchaseBillItem.amount}" /></div></td>
					<td >${item.purchaseBillItem.mark}</td>
				</tr>
				</c:forEach>
				</tbody>
		  	</table>
		</div>
		
		<table border="0" cellspacing="0" cellpadding="0" align="center" class="table-0">
		    <tr>
				<td class="InfoTitleDivider"></td>
			</tr>
		</table>
		
		<table border="0" cellspacing="0" cellpadding="0" align="center" class="table-a2 BillElseInfo">
			<tr>
				<th>经办人：</th>
		    	<td >${record.purchaseBill.managerName}</td>
		    	<th>摘要：</th>
		    	<td >${record.purchaseBill.content}</td>
				<th>备注：</th>
		    	<td >${record.purchaseBill.Mark}</td>
			</tr>
		</table>
		
		<div class="blank12">&nbsp;</div>
		<p class="give">
			<span>开单人：${record.purchaseBill.createrName} <c:if test="${record.purchaseBill.createTime!=null}"><fmt:formatDate value="${record.purchaseBill.createTime}" pattern="yyyy-MM-dd HH:mm"/></c:if></span>
        	<span>审核人：<c:if test="${record.purchaseBillExt.examinerId!=0}">${record.purchaseBillExt.examinerName} <c:if test="${record.purchaseBillExt.examineTime!=null}"><fmt:formatDate value="${record.purchaseBillExt.examineTime}" pattern="yyyy-MM-dd HH:mm"/></c:if></c:if></span>
			<span>单据帐套：${record.tallySetName}</span>
		</p>
		</div>
	   </div>
  </div>
	<div class="modal-buttom">
			<input type="button" class="buttom-a" value=" ${stocName}" onClick="doStoc('${record.purchaseBill.id}');">
			<input type="button" class="buttom-a" value=" 退 出 " onClick="doCancel();">			
	</div>  
</div>
</body>
</html>